import Vue from "vue";
import Router from "vue-router";

// 页面
// import IndexLoad from "../view/IndexLoad.vue"   // 首页loading
const IndexLoad = () => import("@/view/IndexLoad");

// import Index from "../view/Index.vue"   // 首页
const Index = () => import("@/view/Index");

// import DeviceCount from "../view/DeviceCount.vue"   // 设备统计
const DeviceCount = () => import("@/view/DeviceCount");

// import UnitCount from "../view/UnitCount.vue"   // 单位统计
const UnitCount = () => import("@/view/UnitCount");

// import ListPage from "../view/ListPage.vue" // 通用列表页
const ListPage = () => import("@/view/ListPage");

// import NoticeList from "../view/NoticeList.vue" // 公告列表页
const NoticeList = () => import("@/view/NoticeList");

// import Notice from "../view/Notice.vue" // 公告页
const Notice = () => import("@/view/Notice");

// import CompanyListDetail from "../components/detail/CompanyListDetail.vue" // 单位详情
const CompanyListDetail = () => import("@/components/detail/CompanyListDetail");

// import DeviceListDetail from "../components/detail/DeviceListDetail.vue"    // 设备详情
const DeviceListDetail = () => import("@/components/detail/DeviceListDetail");

// import FullMap from "../view/MapDetail.vue"   // 全屏地图
const FullMap = () => import("@/view/MapDetail");

// import Knowledge from "../view/Knowledge.vue"
const Knowledge = () => import("@/view/Knowledge"); // 知识库

const KgDetail = () => import("@/components/detail/kgDetail"); // 知识库详情

// import ConstructionDetail from "../components/detail/ConstructionDetail.vue"
const ConstructionDetail = () =>
  import("@/components/detail/ConstructionDetail");

// import UseRegDetail from "../components/detail/UseRegDetail.vue"
const UseRegDetail = () => import("@/components/detail/UseRegDetail");

// import WarnDetail from "../components/detail/WarnDetail.vue"
const WarnDetail = () => import("@/components/detail/WarnDetail");

// import PersonDetail from "../components/detail/personDetail.vue"
const PersonDetail = () => import("@/components/detail/personDetail");

const ElevatorDetail = () => import("@/components/detail/elevatorDetail");

const PublicPdf = () => import("@/components/container/PublicPdf");

// import Test from "../components/detail/Test.vue"
const Test = () => import("@/components/detail/Test");

const DefaultList = () => import("@/components/list/DefaultList");

// 新增连接->统计页 
const MonitorCount = () => import("@/view/MonitorCount")
const MaintainCount = () => import("@/view/MaintainCount")
const RescueCount = () => import("@/view/RescueCount")
const SupervisionCount = () => import("@/view/SupervisionCount")

// 公共统计图表页
const PublicCount = () => import("@/view/PublicCount")



// 要告诉 vue 使用 vueRouter
Vue.use(Router);

const routes = [
  {
    path: "/test",
    name: "test",
    component: Test,
  },
  {
    path: "/",
    name: "index-load",
    component: IndexLoad,
  },
  {
    path: "/home",
    name: "home",
    component: Index,
  },
  {
    path: "/device-count",
    name: "device-count",
    component: DeviceCount,
  },
  {
    path: "/unit-count",
    name: "unit-count",
    component: UnitCount,
  },
  {
    path: "/list-page",
    name: "list-page",
    component: ListPage,
  },
  {
    path: "/companyList-detail",
    name: "companyList-detail",
    component: CompanyListDetail,
    meta: {
        keepAlive: true, // 需要缓存
      },
  },
  {
    path: "/deviceList-detail",
    name: "deviceList-detail",
    component: DeviceListDetail,
    meta: {
        keepAlive: true, // 需要缓存
      },
  },
  {
    path: "/notice-list",
    name: "notice-list",
    component: NoticeList,
    meta: {
      keepAlive: false, // 需要缓存
    },
  },
  {
    path: "/notice",
    name: "notice",
    component: Notice,
  },
  {
    path: "/full-map",
    name: "full-map",
    component: FullMap,
  },
  {
    path: "/knowledge",
    name: "knowledge",
    component: Knowledge,
  },
  {
    path: "/kg-detail",
    name: "kg-detail",
    component: KgDetail,
  },
  {
    path: "/construction-detail",
    name: "construction-detail",
    component: ConstructionDetail,
    meta: {
        keepAlive: true, // 需要缓存
        isBack: false // 判断是不是返回操作
      },
  },
  {
    path: "/useReg-detail",
    name: "useReg-detail",
    component: UseRegDetail,
    meta: {
        keepAlive: true, // 需要缓存
      },
  },
  {
    path: "/warn-detail",
    name: "warn-detail",
    component: WarnDetail,
    meta: {
        keepAlive: true, // 需要缓存
      },
  },
  {
    path: "/person-detail",
    name: "person-detail",
    component: PersonDetail,
    meta: {
        keepAlive: true, // 需要缓存
      },
  },
  {
    path: "/elevator-detail",
    name: "elevator-detail",
    component: ElevatorDetail,
    meta: {
        keepAlive: true, // 需要缓存
      },
  },
  {
    path: "/public-pdf",
    name: "public-pdf",
    component: PublicPdf,
  },
  {
    path: "/default-list",
    name: "default-list",
    component: DefaultList,
  },
  {
    path: "/monitor-count",
    name: "monitor-count",
    component: MonitorCount,
  },
  {
    path: "/maintain-count",
    name: "maintain-count",
    component: MaintainCount,
  },
  {
    path: "/rescue-count",
    name: "rescue-count",
    component: RescueCount,
  },
  {
    path: "/supervision-count",
    name: "supervision-count",
    component: SupervisionCount,
  },
  {
    path: "/public-count",
    name: "public-count",
    component: PublicCount,
  },
];

var router = new Router({
  routes,
});

export default router;
